#include int main() { FILE *file_pointer; // Open a file for writing file_pointer = fopen("output.txt" "w"); // Write 1000 characters to the file for (int i = 0; i < 1000;="" i++)=""> fputc('a' file_pointer); } // Close the file fclose(file_pointer); printf("Successfully wrote 1000 characters to the file."); return 0; } In this code snippet we first open a file called output.txt for writing using the fopen function. We then use a loop to write 1000 characters (in this case the character 'a') to the file using the fputc function. Finally we close the file using fclose and print a message to confirm that the characters were successfully written.
咨询微信客服
0516-6662 4183
立即获取方案或咨询top